using System;
using System.Collections.Generic;
using System.Text;

namespace News
{
    class Program
    {
        static void Main(string[] args)
        {
            News.nntplib nntp = new nntplib();
            System.Collections.ArrayList newsgroups = new System.Collections.ArrayList();
            System.Collections.ArrayList xoverdata = new System.Collections.ArrayList();
            System.IO.FileInfo file = new System.IO.FileInfo(@"c:\Documents and Settings\Facundo\Desktop\newsgroups2.txt");
            long[] properties = new long[2];

            if (file.Exists)
                file.Delete();
            //System.IO.StreamWriter sw = file.AppendText();
            
            try
            {
                nntp.Connect("news.astraweb.com", 119);

                nntp.Connect(null);

                nntp.Authenticate("fsnprod", "perrycox");
                //newsgroups = nntp.GetNewsgroups();

                properties = nntp.Group("alt.binaries.pictures.purebeauty");
                //xoverdata = nntp.Xover("alt.binaries.pictures.purebeauty", properties[0], properties[0] + 1000);


                for (int i = 0; i < xoverdata.Count; i++)
                {
                    //System.Console.WriteLine(xoverdata[i]);
                    //sw.WriteLine("{0}: {1}", i, xoverdata[i]);
                }
                foreach (string newsgroup in newsgroups)
                {
                    //System.Console.WriteLine("Property: {0}", p.ToString());
                    //sw.WriteLine(newsgroup);
                    //System.Console.WriteLine(newsgroup);
                }
                //System.IO.FileInfo = new System.IO.FileInfo(@"C:\Documents and Settings\Facundo\Desktop\yenc\desktop_knightly_1024x768[1].jpg.ntx");

                System.IO.TextReader tr = new System.IO.StreamReader(@"C:\Documents and Settings\Facundo\Desktop\yenc\7760.jpg.ntx");
                string message = tr.ReadToEnd();
                System.Console.WriteLine("Length is: {0}", message.Length.ToString());
                tr.Close();
                //nntp.Post("z-netz.sprachen.basic", "test subject", "from", message);
                nntp.Header("alt.binaries.pictures.purebeauty", properties[0] + 1000);
                string body = nntp.Body("z-netz.sprachen.basic", properties[0] + 1000);
                //sw.Close();
                nntp.Disconnect();
            }
            catch (System.Exception e)
            {
                System.Console.WriteLine(e.Message);
            }
            Console.ReadLine();
        }
    }
}
